package tgc.edu.tgq.bootstrap.repository;

import java.util.List;

import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import tgc.edu.tgq.bootstrap.custom.BaseRepository;
import tgc.edu.tgq.bootstrap.entity.Course;
import tgc.edu.tgq.bootstrap.entity.Grade;

@Repository
public interface GradeRepository extends BaseRepository<Grade, Integer>{

	public List<Grade> findByStudentId(Integer id);

	public Grade findByStudentIdAndCourseId(Integer id, Integer kcId);
	
	@Query(value ="select distinct t.course from Grade t where t.student.tbClass.id=?1"  )
	public List<Course> findCourseByTbClassId(Integer bjId);
	
	 @Query(value ="from Grade g where g.student.tbClass.id=?1 and g.course.id=?2") 
	 public List<Grade> findByTbClassIdAndCourseId(Integer bjId, Integer couId);
	 @Query(value ="from Grade g where g.student.tbClass.id=?1 and g.student.id=?2") 
	public List<Grade> findByTbClassIdAndStudnetId(Integer bjId, Integer stuId);
	 


}
